home *** CD-ROM | disk | FTP | other *** search
/ PC-X 1997 October / pcx14_9710.iso / swag / delphi.swg / 0025_Getting the Line number in a memo Field.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-11-22  |  429 b   |  18 lines

  1.  
  2. How do you figure out what line number you are currently 
  3. on with a TMemo control?
  4.  
  5. The trick is to use the em_LineFromChar message.  Try this:
  6.  
  7. procedure TMyForm.BitBtn1Click(Sender: TObject);
  8. var
  9.   iLine : Integer ;
  10. begin
  11.    iLine := Memo1.Perform(em_LineFromChar, $FFFF, 0);
  12.    { Note: First line is zero }
  13.    messageDlg('Line Number: ' + IntToStr(iLine), mtInformation, 
  14.               [mbOK], 0 ) ;
  15. end;
  16.  
  17.  
  18.